<?php
/**
 * Created by Phpstorm
 * User: 一个猫
 * Date: 2023/11/27
 * Time: 13:47
 */

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class UpdateController extends Controller
{
    public function update(Request $request)
    {
        $file = $request->file('file');
        $fileName = time() . '_' . $file->getClientOriginalName();
        $filePath = $file->storeAs('uploads', $fileName, 'public');
        return response()->json([
            'data' => [
                'path' => config('app.url') . "/$filePath"
            ],
            'message' => '请求成功！',
            'code' => 200
        ]);
    }
}
